// This is a javascript file

var foo = "bar";


function GetXmlHttpObject(){
  var xmlHttp = null;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }    
    }
  return xmlHttp;
}

function ajaxFunction()
{
    var xmlHttp = GetXmlHttpObject();
    var test = true;
    xmlHttp.onreadystatechange=function()
      {
      if(xmlHttp.readyState==4)    
        {
        document.getElementById("time").innerHTML = xmlHttp.responseText; 
        document.myForm.date.value=xmlHttp.responseText;
        setTimeout("ajaxFunction()", 1000);
        }
      }
    xmlHttp.open("GET","time.jsp",true);
    xmlHttp.send(null);

}



function showTime(){
  //var obj = document.getElementById("time");
  var xmlHttp = GetXmlHttpObject();
  var url = "time.jsp";
  var test = true;
  xmlHttp.open("GET", url);
  xmlHttp.onreadstatechange = function(){
       if(xmlHttp.readyState == 4)
        {
        while(test){
        document.getElementById("showTime").innerHTML = xmlHttp.responseText;
        setTimeout(1000);
        }
        //document.myForm.date.value=xmlHttp.responseText;
        }  
}  

  xmlHttp.send(null);
}


function stateChanged(){
       if(xmlHttp.readyState == 4 && xmlHttp.status == 200)
        {
        obj.innerHTML = xmlHttp.responseText; 
        document.myForm.date.value=xmlHttp.responseText;
        }  
}


function wait(msecs)
{
var start = new Date().getTime();
var cur = start
while(cur - start < msecs)
{
cur = new Date().getTime();
}
} 
